/***********************************************************************************************************************
*                                                                                                                      *
* SPLASH build system v0.1                                                                                             *
*                                                                                                                      *
* Copyright (c) 2013 Andrew D. Zonenberg                                                                               *
* All rights reserved.                                                                                                 *
*                                                                                                                      *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the     *
* following conditions are met:                                                                                        *
*                                                                                                                      *
*    * Redistributions of source code must retain the above copyright notice, this list of conditions, and the         *
*      following disclaimer.                                                                                           *
*                                                                                                                      *
*    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the       *
*      following disclaimer in the documentation and/or other materials provided with the distribution.                *
*                                                                                                                      *
*    * Neither the name of the author nor the names of any contributors may be used to endorse or promote products     *
*      derived from this software without specific prior written permission.                                           *
*                                                                                                                      *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED   *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES        *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR       *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE       *
* POSSIBILITY OF SUCH DAMAGE.                                                                                          *
*                                                                                                                      *
***********************************************************************************************************************/

#ifndef FPGABuildFlags_h
#define FPGABuildFlags_h

/*
	Flags to implement:
		safe_implementation
		optimize_primitives
		register_duplication
		register_balancing
		iob
		equivalent_register_removal
		resource_sharing
		cross_clock_analysis
		read_cores
		power
 */

/**
	@brief Specifies whether to keep hierarchy during synthesis
	
	If not specified, the toolchain will pick a default value.
 */
class FPGASynthesisHierarchyFlag : public FPGASynthesisFlag
{
public:
	enum HierarchyMode
	{
		HIERARCHY_NONE,
		HIERARCHY_SOFT,
		HIERARCHY_KEEP,
	} m_mode;

	FPGASynthesisHierarchyFlag(FPGASynthesisHierarchyFlag::HierarchyMode mode);
	virtual ~FPGASynthesisHierarchyFlag();
	virtual FPGASynthesisFlag* Clone() const;
	virtual std::string toString(const FPGAToolchain* toolchain);
};

/**
	@brief Specifies the post-synthesis hierarchy of the netlist.
	
	If not specified, the toolchain will pick a default value.
 */
class FPGANetlistHierarchyFlag : public FPGASynthesisFlag
{
public:
	enum HierarchyMode
	{
		HIERARCHY_AS_OPTIMIZED,
		HIERARCHY_REBUILT
	} m_mode;

	FPGANetlistHierarchyFlag(FPGANetlistHierarchyFlag::HierarchyMode mode);
	virtual ~FPGANetlistHierarchyFlag();
	virtual FPGASynthesisFlag* Clone() const;
	virtual std::string toString(const FPGAToolchain* toolchain);
};

/**
	@brief Specifies the optimization level and goal used for synthesis.
 */
class FPGASynthesisOptimizationFlag : public FPGASynthesisFlag
{
public:
	enum OptimizationLevel
	{
		OPT_NONE,
		OPT_NORMAL,
		OPT_HIGH
	} m_mode;
	
	enum OptimizationGoal
	{
		OPT_SPEED,
		OPT_AREA
	} m_goal;

	FPGASynthesisOptimizationFlag(
		FPGASynthesisOptimizationFlag::OptimizationLevel mode,
		FPGASynthesisOptimizationFlag::OptimizationGoal goal
		);
	virtual ~FPGASynthesisOptimizationFlag();
	virtual FPGASynthesisFlag* Clone() const;
	virtual std::string toString(const FPGAToolchain* toolchain);
};

class FPGASynthesisMacroFlag : public FPGASynthesisFlag
{
public:
	FPGASynthesisMacroFlag(std::string name, std::string value);
	virtual ~FPGASynthesisMacroFlag();
	virtual FPGASynthesisFlag* Clone() const;
	virtual std::string toString(const FPGAToolchain* toolchain);
	
	std::string m_name;
	std::string m_value;
};

#endif

